import { get, post} from "@/util/request.js";

// 获取banner轮播图列表
export const reqProducts = () => get("/api/v1/products");

// 获取商品列表
export const reqProductList = (data) => get("/api/v1/products", data);

// 获取根据id获取详情
export const reqProductDetail = (id) => get(`/api/v1/products/${id}`);

// 获取分类详情
export const reqProductClass = () => get("/api/v1/product_categories");
// 根据分类获取分类对应的列表
export const reqDDetailAPI = (date) => get(`/api/v1/products?name=${date}`);


// 添加购物车 参数1表示id，参数2表示数量
export const addToCart = (id, num = 1) =>
  post("/api/v1/shop_carts", {
    product: id,
    quantity: num,
  });